<?php
class ResultController extends Zend_Controller_Action
{
    public function init ()
    {
        //        $ajaxContext = $this->_helper->getHelper('AjaxContext');
    //        $ajaxContext->addActionContext('getResult', 'html')->initContext();
    }
    public function indexAction ()
    {
        $result = new Application_Model_ResultMapper();
        $round = $this->_getParam("round");
        if ($round == NULL) {
            $round = $result->getLastRound();
        }
        //        $this->view->round = $round;
        //        
        //            $round = $result->getLastRound();
        $this->view->rounds = $result->getRounds();
        $this->view->selectedRound = $round;
        $this->view->results = $result->fetchAll($round);
    }
    public function resultvizAction ()
    {
        $resultroundMap = new Application_Model_ResultroundMapper();
        $resultMap = new Application_Model_ResultMapper();
        $startRound = $this->_getParam("start");
        $endRound = $this->_getParam("end");
        //        $nameString="Misaka Mikoto,Saber";
        $nameString = $this->_getParam("names");
        if ($nameString != null && $startRound != null && $endRound != null) {
            $names = split(',', $nameString);
            //        $names[] = "Misaka Mikoto";
            //        $names[] = "Saber";
            $this->view->imageSrc = $resultroundMap->getResult(
            $startRound, $endRound, $names);
        }
        $this->view->names = $resultMap->getNames();
        $this->view->enNames = $resultMap->getEnNames();
    }
}

